<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>lastIndex属性</title>
  </head>
  <body></body>
  <script>
    let hd = "houdunren";
    //exec() g
    //必须结合 g 修饰符使用
    // 对 exec 方法有效
    let reg = /\w/g;
    console.log(reg.lastIndex);
    console.log(reg.exec(hd));
    console.log(reg.lastIndex);
    console.log(reg.exec(hd));
  </script>
</html>
